<?php defined("NET2FTP") or die("Direct access to this location is not allowed."); ?>
<!-- Template /skins/india/browse_main.template.php begin -->

<script type="text/javascript"><!--\n";	
function setColor_js(i, checkbox_hidden) {
	// i contains the row number
	// checkbox_hidden determines if the row has a checkbox, or hidden properties

// Set the colors for the rows
	if (i%2 == 1) { bgcolor_true = '#ABABAB'; fontcolor_true = '#000000'; bgcolor_false = '#FFFFFF'; fontcolor_false = '#000000'; }
	else          { bgcolor_true = '#ABABAB'; fontcolor_true = '#000000'; bgcolor_false = '#FFFFFF'; fontcolor_false = '#000000'; }

// Checkbox ==> set the colors depending on the checkbox status
// Hidden ==> set the colors as for an unchecked checkbox
	row_id = 'row' + i;
	checkbox_id = 'list_' + i + '_dirfilename';
	if (document.getElementById) {
		if (checkbox_hidden == 'checkbox' && document.getElementById(checkbox_id).checked == true) { 
			document.getElementById(row_id).style.background = bgcolor_true;  document.getElementById(row_id).style.color = fontcolor_true; 
		} else { 
			document.getElementById(row_id).style.background = bgcolor_false; document.getElementById(row_id).style.color = fontcolor_false; 
		}
	}
	else if (document.all) {
		if (checkbox_hidden == 'checkbox' && document.all[checkbox_id].checked == true) { 
			document.all[row_id].style.background = bgcolor_true;  document.all[row_id].style.color = fontcolor_true; 
		} else { 
			document.all[row_id].style.background = bgcolor_false; document.all[row_id].style.color = fontcolor_false; 
		}
	}
}
//--></script>

                        <form name="BrowseForm" id="BrowseForm" action="<?php echo $net2ftp_globals["action_url"]; ?>" method="post">
<?php                   printLoginInfo(); ?>
                        <input type="hidden" name="state"     value="browse" />
                        <input type="hidden" name="state2"    value="main" />
                        <input type="hidden" name="entry"     value="" />

<?php                           if (isset($warning_directory) == true && $warning_directory != "") { ?>
                                  <div class="warning-box"><div class="warning-text">
                                  <?php echo $warning_directory; ?>
                                  </div></div><br />
<?php                           } ?>

<?php                           if (isset($warning_consumption) == true && $warning_consumption != "") { ?>
                                  <div class="warning-box"><div class="warning-text">
                                  <?php echo $warning_consumption; ?>
                                  </div></div><br />
<?php                           } ?>

<?php                           if (isset($warning_message) == true && $warning_message != "") { ?>
                                  <div class="warning-box"><div class="warning-text">
                                  <?php echo $warning_message; ?>
                                  </div></div><br />
<?php                           } ?>

                        <table align="center" border="0" cellpadding="0" cellspacing="0" width="720">
                          <tbody>
                            <tr valign="top">
                              <td colspan="4" style="text-align: left; padding-left: 20px; font-size: 80%;">
                                <input type="text" name="directory" class="input_directory" value="<?php echo $directory_html; ?>" title="(accesskey g)" accesskey="g"><br />
<?php                           echo __("Directory Tree") . ": $directory_tree"; ?>
                              </td>
                              <td colspan="2" style="text-align: right; padding-right: 20px;">
                                <select class="input_select_big" name="BrowseSelect" onChange="eval(document.BrowseForm.BrowseSelect.options[document.BrowseForm.BrowseSelect.selectedIndex].value);">
                                  <option value="0" selected style="font-weight: bold; text-decoration: underline;"><?php echo __("Actions"); ?>: </option>
<?php	if ($net2ftp_settings["functionuse_newdir"]         == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'newdir', '');"               title="<?php echo __("Make a new subdirectory in directory %1\$s", $net2ftp_globals["directory_html"]); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("New dir"); ?></option><?php } // end if ?>
<?php if ($net2ftp_settings["functionuse_newfile"]        == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'edit', 'newfile');"          title="<?php echo __("Create a new file in directory %1\$s", $net2ftp_globals["directory_html"]); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("New file"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_easyWebsite"]    == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'easyWebsite', '');"          title="<?php echo __("Create a website easily using ready-made templates"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("HTML templates"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_upload"]         == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'upload', '');"               title="<?php echo __("Upload new files in directory %1\$s", $net2ftp_globals["directory_html"]); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Upload"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_jupload"]        == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'jupload', '');"              title="<?php echo __("Upload directories and files using a Java applet"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Java Upload"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_advanced"]       == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'advanced', 'main');"         title="<?php echo __("Go to the advanced functions"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Advanced"); ?></option><?php } // end if ?>
                                                                        <option value="" style="font-weight: bold; text-decoration: underline;"><?php echo __("Transform selected entries: "); ?></option>
<?php	if ($net2ftp_settings["functionuse_copy"]           == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'copymovedelete', 'copy');"   title="<?php echo __("Copy the selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Copy"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_move"]           == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'copymovedelete', 'move');"   title="<?php echo __("Move the selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Move"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_delete"]         == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'copymovedelete', 'delete');" title="<?php echo __("Delete the selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Delete"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_rename"]         == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'rename', '');"               title="<?php echo __("Rename the selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Rename"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_chmod"]          == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'chmod', '');"                title="<?php echo __("Chmod the selected entries (only works on Unix/Linux/BSD servers)"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Chmod"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_downloadzip"]    == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'downloadzip', '');"          title="<?php echo __("Download a zip file containing all selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Download"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_zip"]            == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'zip', 'zip');"               title="<?php echo __("Zip the selected entries to save or email them"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Zip"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_calculatesize"]  == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'calculatesize', '');"        title="<?php echo __("Calculate the size of the selected entries"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Size"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_findstring"]     == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'findstring', '');"           title="<?php echo __("Find files which contain a particular word"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Search"); ?></option><?php } // end if ?>
                                                                        <option value="" style="font-weight: bold; text-decoration: underline;"><?php echo __("Transform selected entry: "); ?></option>
<?php	if ($net2ftp_settings["functionuse_view"]           == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'view', '');"                 title="<?php echo __("View the highlighted source code of file %1\$s", $list_files[$i]["dirfilename_html"]);               ?>">&nbsp;&nbsp;&nbsp;<?php echo __("View"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_edit"]           == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'edit', '');"                 title="<?php echo __("Edit the source code of file %1\$s", $list_files[$i]["dirfilename_html"]);                           ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Edit"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_update"]         == "yes") { ?><option value="submitBrowseForm('<?php echo $directory_js; ?>', '', 'update', '');"               title="<?php echo __("Upload a new version of the file %1\$s and merge the changes", $list_files[$i]["dirfilename_html"]); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Update"); ?></option><?php } // end if ?>
<?php	if ($net2ftp_settings["functionuse_open"]           == "yes") { ?><option value="window.open('<?php echo $list_links_js[$i]; ?>');"                                 title="<?php echo __("View the file %1\$s from your HTTP web server", $list_files[$i]["dirfilename_html"]); ?> &#13; <?php echo __("(Note: This link may not work if you don't have your own domain name.)"); ?>">&nbsp;&nbsp;&nbsp;<?php echo __("Open"); ?></option><?php } // end if ?>
                                </select>
                              </td>
                            </tr>
                            <tr onMouseOver="this.style.color='#000000'; this.style.backgroundColor='#ffcc00';" onMouseOut="this.style.color='#000000'; this.style.backgroundColor='#FFFFFF';">
                              <td colspan="6" title="<?php echo __("Go to the parent directory"); ?>" style="cursor: pointer; cursor: hand; border: 0px; text-align: center;" onClick="javascript:submitBrowseForm('<?php echo $updirectory_js; ?>', '', 'browse', 'main');">
                                <a href="<?php echo $action_url . "&amp;directory=" . $updirectory_url . "&amp;state=browse&amp;state2=main"; ?>">
                                <?php printActionIcon("up", "", ""); ?>
                                </a>
                              </td>
                            </tr>
<?php $rowcounter = 0; ?>
<?php /* ----- Directories ----- */ ?>
<?php	                    if ($list["stats"]["directories"]["total_number"] > 0) { ?>
                            <tr>
                              <td colspan="6">
                                <b><?php echo __("Directories"); ?></b> (<?php echo $list["stats"]["directories"]["total_number"]; ?>)
                              </td>
                            </tr>
<?php                       for ($i=1; $i<=sizeof($list_directories);) { ?>
                              <tr>
<?php                         for ($column_counter=1; $column_counter<=6; $column_counter++) { ?>
<?php                             if ($i<=sizeof($list_directories)) { ?>
<?php                               $rowcounter++; ?>
                                    <td id="row<?php echo $rowcounter; ?>" title="<?php echo __("Go to the subdirectory %1\$s", $list_directories[$i]["dirfilename_html"]); ?> | <?php echo __("Size"); ?>: <?php echo $list_directories[$i]["size"]; ?> | <?php echo __("Owner"); ?>: <?php echo $list_directories[$i]["owner"]; ?> | <?php echo __("Group"); ?>: <?php echo $list_directories[$i]["group"]; ?> | <?php echo __("Perms"); ?>: <?php echo $list_directories[$i]["permissions"]; ?> | <?php echo __("Mod Time"); ?>: <?php echo $list_directories[$i]["mtime"]; ?>" onMouseOver="this.style.color='#000000'; this.style.backgroundColor='#ffcc00';" onMouseOut="this.style.color='#000000'; setColor_js(<?php echo $rowcounter; ?>, 'checkbox');">
                                      <div class="browse_cell">
<?php				              printDirFileProperties($rowcounter, $list_directories[$i], "checkbox", "onClick=\"setColor_js($rowcounter, 'checkbox');\""); ?>
<?php					        printMime("icon", $list_directories[$i]); ?><br />
                                      <a href="<?php echo $action_url . "&amp;directory=" . $list_directories[$i]["newdir_url"] . "&amp;state=browse&amp;state2=main"; ?>">
                                      <?php echo $list_directories[$i]["dirfilename"]; ?>
                                      </a>
                                      </div>
                                    </td>
<?php                               $i++; ?>
<?php                             } else { ?>
                                    <td><div class="browse_cell">&nbsp;</div></td>
<?php                             } ?>
<?php		                  } // end for column_counter ?>
                              </tr>
<?php		                } // end for i ?>
<?php	                    } // end if ?>

<?php /* ----- Files ----- */ ?>
<?php	                    if ($list["stats"]["files"]["total_number"] > 0) { ?>
                            <tr>
                              <td colspan="6">
                                <b><?php echo __("Files"); ?></b> (<?php echo $list["stats"]["files"]["total_number"]; ?> / <?php echo $list["stats"]["files"]["total_size_formated"]; ?>)
                              </td>
                            </tr>
<?php                       for ($i=1; $i<=sizeof($list_files);) { ?>
                              <tr>
<?php                         for ($column_counter=1; $column_counter<=6; $column_counter++) { ?>
<?php                             if ($i<=sizeof($list_files)) { ?>
<?php                               $rowcounter++; ?>
                                    <td id="row<?php echo $rowcounter; ?>" title="<?php echo __("Download the file %1\$s", $list_files[$i]["dirfilename_html"]); ?> | <?php echo __("Size"); ?>: <?php echo $list_files[$i]["size"]; ?> | <?php echo __("Owner"); ?>: <?php echo $list_files[$i]["owner"]; ?> | <?php echo __("Group"); ?>: <?php echo $list_files[$i]["group"]; ?> | <?php echo __("Perms"); ?>: <?php echo $list_files[$i]["permissions"]; ?> | <?php echo __("Mod Time"); ?>: <?php echo $list_files[$i]["mtime"]; ?>" onMouseOver="this.style.color='#000000'; this.style.backgroundColor='#ffcc00';" onMouseOut="this.style.color='#000000'; setColor_js(<?php echo $rowcounter; ?>, 'checkbox');">
                                      <div class="browse_cell">
<?php				              printDirFileProperties($rowcounter, $list_files[$i], "checkbox", "onClick=\"setColor_js($rowcounter, 'checkbox');\""); ?>
<?php					        printMime("icon", $list_files[$i]); ?><br />
                                      <a href="<?php echo $action_url . "&amp;directory=" . $directory_url . "&amp;entry=" . $list_files[$i]["dirfilename_url"] . "&amp;state=downloadfile"; ?>">
<?php 					  echo $list_files[$i]["dirfilename"]; ?>
                                      </a>
						  </div>
                                    </td>
<?php                               $i++; ?>
<?php                             } else { ?>
                                    <td><div class="browse_cell">&nbsp;</div></td>
<?php                             } ?>
<?php		                  } // end for column_counter ?>
                              </tr>
<?php		                } // end for i ?>
<?php	                    } // end if ?>

<?php /* ----- Symlinks ----- */ ?>
<?php	                    if ($list["stats"]["symlinks"]["total_number"] > 0) { ?>
                            <tr>
                              <td colspan="6">
                                <b><?php echo __("Symlinks"); ?></b> (<?php echo $list["stats"]["symlinks"]["total_number"]; ?>)
                              </td>
                            </tr>
<?php                       for ($i=1; $i<=sizeof($list_symlinks);) { ?>
                              <tr>
<?php                         for ($column_counter=1; $column_counter<=6; $column_counter++) { ?>
<?php                             if ($i<=sizeof($list_symlinks)) { ?>
<?php                               $rowcounter++; ?>
                                    <td id="row<?php echo $rowcounter; ?>" title="<?php echo __("Download the file %1\$s", $list_symlinks[$i]["dirfilename_html"]); ?> | <?php echo __("Size"); ?>: <?php echo $list_symlinks[$i]["size"]; ?> | <?php echo __("Owner"); ?>: <?php echo $list_symlinks[$i]["owner"]; ?> | <?php echo __("Group"); ?>: <?php echo $list_symlinks[$i]["group"]; ?> | <?php echo __("Perms"); ?>: <?php echo $list_symlinks[$i]["permissions"]; ?> | <?php echo __("Mod Time"); ?>: <?php echo $list_symlinks[$i]["mtime"]; ?>" onMouseOver="this.style.color='#000000'; this.style.backgroundColor='#ffcc00';" onMouseOut="this.style.color='#000000'; setColor_js(<?php echo $rowcounter; ?>, 'checkbox');">
                                      <div class="browse_cell">
<?php				              printDirFileProperties($rowcounter, $list_symlinks[$i], "checkbox", "onClick=\"setColor_js($rowcounter, 'checkbox');\""); ?>
<?php					        printMime("icon", $list_symlinks[$i]); ?><br />
                                      <a href="<?php echo $action_url . "&amp;directory=" . $directory_url . "&amp;entry=" . $list_symlinks[$i]["dirfilename_url"] . "&amp;state=downloadfile"; ?>">
                                      <?php echo $list_symlinks[$i]["dirfilename"]; ?>
                                      </a>
                                      </div>
                                    </td>
<?php                               $i++; ?>
<?php                             } else { ?>
                                    <td><div class="browse_cell">&nbsp;</div></td>
<?php                             } ?>
<?php		                  } // end for column_counter ?>
                              </tr>
<?php		                } // end for i ?>
<?php	                    } // end if ?>

<?php /* ----- Unrecognized ----- */ ?>
<?php	                    if ($list["stats"]["unrecognized"]["total_number"] > 0) { ?>
                            <tr>
                              <td colspan="6">
                                <b><?php echo __("Unrecognized FTP output"); ?></b> (<?php echo $list["stats"]["unrecognized"]["total_number"]; ?>)
                              </td>
                            </tr>
<?php                       for ($i=1; $i<=sizeof($list_unrecognized);) { ?>
                              <tr>
<?php                         for ($column_counter=1; $column_counter<=6; $column_counter++) { ?>
<?php                             if ($i<=sizeof($list_unrecognized)) { ?>
<?php                               $rowcounter++; ?>
                                    <td onMouseOver="this.style.color='#000000'; this.style.backgroundColor='#ffcc00';" onMouseOut="this.style.color='#000000'; setColor_js(<?php echo $rowcounter; ?>, 'checkbox');">
                                      <div class="browse_cell">
<?php					        printMime("icon", $list_unrecognized[$i]); ?><br />
                                      <?php echo $list_unrecognized[$i]["dirfilename"]; ?>
                                      </div>
                                    </td>
<?php                               $i++; ?>
<?php                             } else { ?>
                                    <td><div class="browse_cell">&nbsp;</div></td>
<?php                             } ?>
<?php		                  } // end for column_counter ?>
                              </tr>
<?php		                } // end for i ?>
<?php	                    } // end if ?>

<?php /* ----- Empty folder ----- */ ?>
<?php	                    if ($rowcounter == 0) { ?>
                            <tr>
                              <td colspan="6" style="text-align: center;">
                                <br /><?php echo __("This folder is empty"); ?><br /><br />
                              </td>
                            </tr>
<?php                     } // end if ?>
                          </tbody>
                        </table>
                        </form>
<script type="text/javascript"><!--
  document.BrowseForm.BrowseSelect.selectedIndex=0;
//--></script>
<?php require_once($net2ftp_globals["application_skinsdir"] . "/" . $net2ftp_globals["skin"] . "/footer.template.php"); ?>
<!-- Template /skins/india/browse_main.template.php end -->
